package com.hiwhitley.easy.day14;

/**
 * Created by hiwhitley on 2016/8/18.
 */
public class RemoveDuplicates {
    public static int removeDuplicates(int[] nums) {
        int i=1;
        for(int j=1; j<nums.length; ++j)
            if(nums[j]!=nums[j-1]) nums[i++] = nums[j];
        return i;
    }

    public static void main(String[] args) {
        System.out.println(removeDuplicates(new int[]{1, 1, 2, 2}));

    }
}
